package com.hb.trade.client.project;

import cn.hutool.json.JSONObject;
import com.hb.core.pojo.parent.PageResult;
import com.hb.core.pojo.project.file.dto.BidFileInfoDTO;
import com.hb.core.pojo.project.file.entity.BidBuyRecord;
import com.hb.core.pojo.project.file.entity.BidFileInfo;
import com.hb.core.pojo.project.section.dto.BidSectionDTO;
import org.fzzn.core.model.msg.Message;
import org.fzzn.core.model.msg.ResponseDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * describe:
 * 招标文件相关
 *
 * @author zhongdl
 * @date 2021/12/10
 */
@FeignClient("hb-project")
public interface BidFileInfoClient {

    /**
     * @param sectionId:
     * @Description: 根据标段id获取招标文件信息
     * @Author: zhongdl
     * @Date:2022/2/17 8:54
     * @return: {@link Message< BidFileInfoDTO> }
     **/
    @GetMapping("/bidFileInfo/getBidFileInfoBySectionId")
    Message<BidFileInfoDTO> getBidFileInfoBySectionId(@RequestParam Long sectionId);

    /**
     * @param bidFileInfo:
     * @Description: 保存招标文件信息
     * @Author: zhongdl
     * @Date:2021/12/13 13:52
     * @return: {@link org.fzzn.core.model.msg.Message<java.lang.Boolean>}
     * @update zhaojk
     **/
    @PostMapping("/bidFileInfo/saveBidFileInfo")
    Message<BidFileInfo> saveBidFileInfo(@RequestBody BidFileInfoDTO bidFileInfo);

    /**
     * 售卖记录
     *
     * @param sectionDto
     * @return
     */
    @PostMapping("/bidBuyRecord/saleRecord")
    Message saleRecord(@RequestBody BidSectionDTO sectionDto);


    /**
     * 查询标段的下载记录
     *
     * @param sectionDto
     * @return
     */
    @PostMapping("/bidBuyRecord/listDownloadBySectionId")
    Message<List<JSONObject>> listDownloadBySectionId(@RequestBody BidSectionDTO sectionDto);


    /**
     * 投标人支付成功保存供应商购标记录
     * 如果已存在的数据将直接返回
     *
     * @param bidBuyRecord
     * @return
     */
    @PutMapping("/bidBuyRecord/saveRecord")
    Message<Boolean> saveRecord(@RequestBody BidBuyRecord bidBuyRecord);

    /**
     * 投标人下载成功之后更新领购信息
     *
     * @param bidBuyRecord
     * @return
     */
    @PostMapping("/bidBuyRecord/updateRecord")
    Message updateRecord(@RequestBody BidBuyRecord bidBuyRecord);

    /**
     * 查询指定项目ID的招标文件列表(带分页)
     *
     * @param bidFileInfoDTO #projectId
     * @return
     * @update zhaojk
     */
    @PostMapping("/bidFileInfo/pageFilesByProjectId")
    Message<PageResult<BidFileInfoDTO>> pageFilesByProjectId(@RequestBody BidFileInfoDTO bidFileInfoDTO);

    /**
     * @param bidFileInfoDTO:
     * @Description: 查询指定项目ID的招标文件列表(不带分页)
     * @Author: zhongdl
     * @Date:2022/1/17 9:09
     * @return: {@link ResponseDto }
     **/
    @PostMapping("/bidFileInfo/listFilesByProjectId")
    Message<List<BidFileInfo>> listFilesByProjectId(@RequestBody BidFileInfoDTO bidFileInfoDTO);

    /**
     * 查询招标文件详情
     * 获取所有与该招标文件的标段将信息返回
     *
     * @param fileId
     * @return
     * @update zhaojk
     */
    @PostMapping("/bidFileInfo/getBidFileInfo")
    Message<BidFileInfoDTO> getBidFileInfo(@RequestParam("fileId") Long fileId);

    /**
     * 发布招标文件
     * 修改发布状态
     * (该接口会验证指定的招标文件是否满足发布的条件)
     *
     * @param fileId
     * @return
     */
    @PostMapping("/bidFileInfo/deploy")
    Message<Boolean> deploy(@RequestParam("fileId") Long fileId);

    /**
     * 关联标段
     *
     * @param bidFileInfoDTO
     * @return
     */
    @PostMapping("/bidFileInfo/relateSections")
    Message<Boolean> relateSections(BidFileInfoDTO bidFileInfoDTO);

    /**
     * Description: 判断当前企业是否已购买标书
     * @author: fengbin
     * @date: 2022/2/28 15:27
     * @param bidBuyRecord
     @return: org.fzzn.core.model.msg.Message<java.lang.Boolean>
     */
    @PostMapping("/bidBuyRecord/judgeCompanyRecord")
    Message<Boolean> judgeCompanyRecord(@RequestBody BidBuyRecord bidBuyRecord);


    /**
     * 招标文件变更流程
     * @author tian
     * @date 2022-4-13 14:01
     * @param bidFileInfoDTO
     * @return org.fzzn.core.model.msg.Message<java.lang.String>
     */
    @PostMapping("/bidFileInfo/changeProcess")
    Message<String> changeProcess(@RequestBody BidFileInfoDTO bidFileInfoDTO);

    /**
     * 根据多标段查询采购信息
     *
     * @author yuezheng
     * @param sectionIdList
     * @return org.fzzn.core.model.msg.Message
     * @date 2022/4/16 4:18 PM
     */
    @PostMapping("/bidBuyRecord/findBySectionIdList")
    Message<List<BidBuyRecord>> findBuyRecordBySectionIdList(@RequestBody List<Long> sectionIdList);


    /**
     * 查询招标项目是否已创建了流程
     * @author tian
     * @date 2022-4-13 14:01
     * @param bidFileInfoDTO
     * @return org.fzzn.core.model.msg.Message<java.lang.String>
     */
    @PostMapping("/bidFileInfo/selectSimpleOrStandard")
    Message<Integer> selectSimpleOrStandard(@RequestBody BidFileInfoDTO bidFileInfoDTO);


    /**
     * 查询招标项目是否存在已发布的招标文件
     * @author tian
     * @date 2022-4-13 14:01
     * @param bidFileInfoDTO
     * @return org.fzzn.core.model.msg.Message<java.lang.String>
     */
    @PostMapping("/bidFileInfo/selectReleaseFlag")
    Message<Integer> selectReleaseFlag(@RequestBody BidFileInfoDTO bidFileInfoDTO);

    /**
     *
     * @Description:查询当前企业生成的招标文件
     * @Author: zhongdl
     * @Date:2022/5/27 15:12
     * @param collectionIdList:收款方式详
     * @return: {@link Message< List< BidFileInfoDTO>> }
     **/
    @PostMapping("/bidFileInfo/judgeCollectionIdFlag")
    Message<List<BidFileInfoDTO>> judgeCollectionIdFlag(@RequestBody List<Long> collectionIdList);


    /**
     * @Description: 根据公告ID查询已发布的招标文件
     *
     * @author yuezheng
     * @param bidFileInfoDTO
     * @return org.fzzn.core.model.msg.Message<java.util.List<com.hb.core.pojo.project.file.dto.BidFileInfoDTO>>
     * @date 2022/6/23 14:18
     */
    @PostMapping("/bidFileInfo/findReleaseBidFileByNoticeId")
    Message<List<BidFileInfoDTO>> findReleaseBidFileByNoticeId(@RequestBody BidFileInfoDTO bidFileInfoDTO);


}
